package com.jingge.home.dto;

import com.jingge.home.util.codec.JsonUtil;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Yongxiang
 * @date 2025-06-05 13:55
 * @email 1158055613@qq.com
 */
@Getter
@Setter
public class ConversationDto {
	private Map<String,String> inputs=new HashMap<>();

	private String query;

	private String response_mode;

	private String conversation_id;

	private String user;

	private List<UploadFiles> files=new ArrayList<>();

	public ConversationDto(String query,
	                       String conversation_id,
	                       String user) {
		this.query = query;
		this.conversation_id = conversation_id;
		this.response_mode = "streaming";
		this.user = user;
	}

	public ConversationDto(String query,
	                       String conversation_id,
	                       String user,
	                       String picUrl) {
		this.query = query;
		this.conversation_id = conversation_id;
		this.response_mode = "streaming";
		this.user = user;
		UploadFiles uploadFiles = new UploadFiles();
		uploadFiles.setUrl(picUrl);
		uploadFiles.setType("image");
		uploadFiles.setTransfer_method("remote_url");
		this.files.add(uploadFiles);
	}

	@Override
	public String toString() {
		return JsonUtil.pojoToJsonString(this);
	}

	@Data
	public static class UploadFiles {
		private String type;

		private String transfer_method;

		private String url;
	}
}
